namespace eval ::Stealth {
	StartTCL::Provide

	variable ::Stealth::PlayerState
	variable ::Stealth::Spells
  array set ::Stealth::Spells {
			 1784
			 1785
			 1786
			 1787
			 8822
			30831
			30991
			31526
			31621
			32199
			32615
			34189
	}
}


proc ::Stealth::OnCastStealth { to from spellid } {
	::SetQFlag $from stealth
}


proc ::Stealth::BreakStealth { player } {
	::ClearQFlag $player stealth
	::CastSpell $player $player 12844
}


proc ::Stealth::Init { } {
	if { [ info exists "::StartTCL::VERSION" ] } {
		::Custom::HookProc "::AI::CanAgro" {; if { [ ::GetQFlag $victim stealth ] } { return 0 } }
		::Custom::HookProc "::WoWEmu::DamageReduction" {; if { [ ::GetQFlag $player stealth ] } { ::Stealth::BreakStealth $player } }
		::Custom::AddSpellScript "::Stealth::OnCastStealth" [ array names ::Stealth::Spells ]
	} else {
		
	}
}

::Stealth::Init